package persist

import (
	"gopkg.in/olivere/elastic.v5"
	"context"
)

var client, _ = elastic.NewClient()

func ItemSave() chan interface{} {

	out := make(chan interface{})
	go func() {
		for {
			item := <-out
			client.Index().Index("imooc").Type("zhenai").BodyJson(item).Do(context.Background())
		}
	}()
	return out
}
